<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : news.xsl
    Created on : Ngày 22 tháng 3 năm 2013, 13:47
    Author     : skunk
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

    <xsl:output method="html"/>

    <!-- TODO customize transformation rules
         syntax recommendation http://www.w3.org/TR/xslt
    -->
    <xsl:template match="/">
        <html>
            <body>
                <xsl:apply-templates />
            </body>
        </html>
    </xsl:template>

    <xsl:template match="news">
      
        <table border ="0" width = "95%"
        style = "border:2px dotted black; border-collapse:collapse; background-color:white; 
        margin-top:10px; margin-bottom:10px; margin-left:10px; margin-right:10px" >
            <tr align = "left">
                <td>
                    <h4></h4>
                </td>
                <td>
                    <h4>Title</h4>
                </td>
                <td>
                    <h4>Header</h4>
                </td>

            </tr>
            <xsl:for-each select="new">
                <xsl:sort select="date" order="descending"/>

                <tr>
                    <td>
                        <div style="margin-left:5px; margin-right:5px; margin-top:5px; margin-bottom:5px">
                            <img class="img-pro" style = "cursor:pointer; width: 100px; height: 100px"
                        onclick="window.location.href='newsDetail.jsp?pid={ID}'">
                                <xsl:attribute name="src">
                                    <xsl:value-of select="image"/>
                                </xsl:attribute>
                            </img>
                        </div>
                    </td>
                    <td valign="top">
                        <div style="margin-right:5px; margin-top:5px; margin-bottom:5px; width: 300px; cursor:pointer"
                        onclick="window.location.href='newsDetail.jsp?pid={ID}'"
                        onmouseover="style.fontWeight = 'bold'" onmouseout="style.fontWeight = 'normal'">
                            <xsl:value-of select = "title"/>
                        </div>
                    </td>
                    <td valign="top">
                        <div style="margin-right:5px; margin-top:5px; margin-bottom:5px">
                            <xsl:value-of select = "header"/>
                        </div>
                        <div style="color:blue; text-decoration:underline; margin-right:5px" align="right" >
                            <p style = "cursor:pointer"
                            onmouseover="style.fontWeight = 'bold'" onmouseout="style.fontWeight = 'normal'"
                            onclick="window.location.href='newsDetail.jsp?pid={ID}'">(xem tiếp)
                            </p>
                        </div>
                    </td>


                </tr>
            </xsl:for-each>
        </table>

    </xsl:template>

</xsl:stylesheet>
